const app = getApp()
const { currentTab } = app.globalData

Component({
  data: {
		showTabBar: true,
		currentTab,		// 当前选中 Tab 的 index
		list: [
      {
        pagePath: "/pages/work/work",
				text: "工作",
				icon: 'icon-work',
      },
      {
        pagePath: "/pages/assistant/assistant",
				text: "助手",
				icon: 'icon-assistant'
			},
			{
        pagePath: "/pages/often/often",
				text: "常用",
				icon: 'icon-add'
      },
      {
        pagePath: "/pages/analyse/analyse",
				text: "分析",
				icon: 'icon-analyse'
			},
			{
        pagePath: "/pages/me/me",
				text: "我",
				icon: 'icon-me'
      }
    ]
  },
  methods: {
		switchTab(e) {
			const { path, index } = e.currentTarget.dataset
			console.log('index:', index)
			app.globalData.currentTab = index
			wx.switchTab({ url: path })
			// this.setData({ currentTab: index })
    }
  }
})
